Skip to content

[OpenAL] Fix sourceSeek crash on stopped sources#26770

Open
uniformization wants to merge 3 commits intoemscripten-core:mainfrom
uniformization:main
Open

[OpenAL] Fix sourceSeek crash on stopped sources#26770
uniformization wants to merge 3 commits intoemscripten-core:mainfrom
uniformization:main

Conversation

@uniformization
Copy link
Copy Markdown

@uniformization uniformization commented Apr 24, 2026

If you tried to use AL_SEC_OFFSET on a stopped audio source, sourceSeek would throw a TypeError because audioBuf would be undefined.

@sbc100 sbc100 changed the title Fix sourceSeek crash on stopped sources [OpenAL] Fix sourceSeek crash on stopped sources Apr 24, 2026
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you maybe modify one of the existing tests in test_browser.py or test_inerative.py to cover this?

@uniformization
Copy link
Copy Markdown
Author

uniformization commented Apr 25, 2026

Could you maybe modify one of the existing tests in test_browser.py or test_inerative.py to cover this?

@sbc100 I have added a test to test_openal_playback.c to cover the issue.

Comment thread src/lib/libopenal.js Outdated
assert(state == AL_STOPPED);
alSourcef(source, AL_SEC_OFFSET, 0.5f);
alGetSourcei(source, AL_SOURCE_STATE, &state);
assert(state == AL_STOPPED);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm this new test fails without this patch?

Copy link
Copy Markdown
Author

@uniformization uniformization Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if the fix for this is good enough or if there's a better way of going about it. When an error is thrown from a function that was called with emscripten_async_call, it won't fail the test. (Line 306)

Comment thread src/lib/libopenal.js Outdated
Comment thread src/lib/libopenal.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants